/*
 * Copyright (c) 2001, 2002 Boris Pruessmann and others. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Common Public License v0.5 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors: Boris Pruessmann - Initial implementation.
 */
package net.sourceforge.perforce.ui.model;

import net.sourceforge.perforce.core.PerforceCorePlugin;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;

/**
 * @version $Revision: 488 $
 * @author <a href="mailto:bpruessmann@users.sourceforge.net">Boris
 *         Pruessmann</a>
 */
public class AllRootsElement implements IWorkbenchAdapter, IAdaptable {
  // ---------------------------------------------------------- Public Methods
  // (IWorkbenchAdapter)

  public Object[] getChildren(Object o) {
    return PerforceCorePlugin.getServerManager().getPerforceServers();
  }

  public ImageDescriptor getImageDescriptor(Object object) {
    return null;
  }

  public String getLabel(Object o) {
    return null;
  }

  public Object getParent(Object o) {
    return null;
  }

  //----------------------------------------------------------------------------
  // -- Public Methods

  @SuppressWarnings("unchecked")
  // adapter
  public Object getAdapter(Class adapter) {
    return (adapter == IWorkbenchAdapter.class) ? this : null;
  }
}
